//
//  WPRecordViewModel.h
//  health
//
//  Created by apple on 2021/11/9.
//  Copyright © 2021 zglee. All rights reserved.
//

#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN

typedef void (^HttpSuccessBlock)(id model);
typedef void (^HttpFailureBlock)(NSError *error);

@interface MJHttpNetWorking : NSObject

@property (nonatomic, strong) RACCommand * command;

+ (void)requestWithParams:(NSDictionary *)params
              requestUri:(NSString *)requestUri
              requestType:(MJHttpRequestType)requestType
              showLoading:(BOOL)showLoading
              success:(HttpSuccessBlock)success
              failure:(HttpFailureBlock)failure;

/**
 PUT请求(Body传送参数)

 @param seccess 成功回调
 @param failure 失败回调
 */
- (void)mj_putBodyWithSuccess:(HttpSuccessBlock)seccess failure:(HttpFailureBlock)failure;

/**
 POST请求(Body传送参数)

 @param seccess 成功回调
 @param failure 失败回调
 */
- (void)mj_postBodyWithSuccess:(HttpSuccessBlock)seccess failure:(HttpFailureBlock)failure;

/**
 delete请求

 @param seccess 成功回调
 @param failure 失败回调
 */
- (void)mj_deleteWithSuccess:(HttpSuccessBlock)seccess failure:(HttpFailureBlock)failure;

/**
 PUT请求

 @param seccess 成功回调
 @param failure 失败回调
 */
- (void)mj_putWithSuccess:(HttpSuccessBlock)seccess failure:(HttpFailureBlock)failure;

/**
 GET请求

 @param seccess 成功回调
 @param failure 失败回调
 */
- (void)mj_getWithSuccess:(HttpSuccessBlock)seccess failure:(HttpFailureBlock)failure;

#pragma mark -
/// 获取手机验证码
/// @param phoneNumber 手机号
/// @param success 成功
/// @param failure 失败
+ (void)sendPhoneCodeWithPhoneNumber:(NSString *)phoneNumber success:(HttpSuccessBlock)success failure:(HttpFailureBlock)failure;


+ (void)uploadImageWithParams:(NSDictionary *)params
              requestUri:(NSString *)requestUri
                 image:(UIImage *)image
              showLoading:(BOOL)showLoading
              success:(HttpSuccessBlock)success
                      failure:(HttpFailureBlock)failure;
@end

NS_ASSUME_NONNULL_END
